#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class QSerialPortInfo;
class QSerialPort;
class SerialThread;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

signals:
    void SignalStartThread();

private slots:
    void SlotWriteLog(const QByteArray&);
    void SlotCCID(const QString&);
    void SlotIMEI(const QString&);
    void SlotCSQ(const QString&);
    void SlotUpDownCount(bool);

private slots:
    void on_ComButton_clicked();
    void on_OpenBtn_clicked();
    void on_SerialRefreshBtn_clicked();
    void on_ClrLogBtn_clicked();

    void on_ClrNumBtn_clicked();

    void on_ClrUpDownBtn_clicked();

private:
    void SetupUI();
    void InitSerail();
    void ClosePort();

    QString GetRecvNumStr(size_t n);
    QString GetSndNumStr(size_t n);

private:
    Ui::MainWindow *ui;
    SerialThread* m_SerialThread;
    bool m_SerialIsOpen;
    bool m_TestFlag;

    unsigned int mUpCnt = 0;
    unsigned int mDownCnt = 0;
};

#endif // MAINWINDOW_H
